import requests
import config
#请求头为json

response1 = requests.get(url=f"{config.BASE_URL}/api/captchaImage")
uuid=response1.json().get("uuid")
print(uuid)
requests_header={
    "Content-Type":"application/json"
}
json_data={
    "username": config.USERNAME,
    "password": config.PASSWORD,
    "code": "2",
    "uuid": uuid
}
response2 = requests.post(url="http://kdtx-test.itheima.net/api/login", headers=requests_header, json=json_data)
print(response2.json())
assert response2.status_code == 200
assert response2.json().get("code") == 200
assert "成功" in response2.text

